package com.chainyoung.component_tmperson.ui.mvp.contract;

import com.chainyoung.common.appcommon.entity.HdWalletCache;
import com.chainyoung.common.mvp.IModel;
import com.chainyoung.common.mvp.IView;
import com.chainyoung.component_tmperson.entity.BookMark;
import com.chainyoung.component_tmperson.entity.BrowseCache;
import com.chainyoung.component_tmperson.entity.CheckBookMarkResult;

import org.json.JSONException;
import org.web3j.crypto.CipherException;

import java.io.IOException;
import java.util.List;
import java.util.TreeMap;

import io.reactivex.Flowable;

public interface OtheAppSendTransactionContract {

    interface View extends IView {

        void onGetGasPriceSuccess(String data);

        void onSendTransactionSuccess(String hash);

        void onSendTransactionFailed();

        void onGetNonce(String nonce) throws JSONException, CipherException, IOException;

        void onCheckIsUrlCollected(CheckBookMarkResult result);

        void onDelBookmarkSuccess(List<BookMark> data);

        void onAddBookmarkSuccess(List<BookMark> data);

        void onAddHdWalletCacheSuccess(HdWalletCache data);

        void onGetAllHdWalletCaches(List<HdWalletCache> datas);

        void onGetSingleEthBalanceSuccess(String data,String addr);

        void onGetSingleEthBalanceFailed();


    }

    interface Model extends IModel {

        Flowable<String> getGasPrice();

        Flowable<String> sendTransaction(String hex);

        Flowable<String> getNonce(String addr);

        Flowable<CheckBookMarkResult> checkIsUrlCollected(TreeMap<String, Object> map);

        Flowable<List<BookMark>> delBookmark(TreeMap<String, Object> map);

        Flowable<List<BookMark>> addBookmark(TreeMap<String, Object> map);

        Flowable<BrowseCache> addBrowseCache(BrowseCache item);

        Flowable<HdWalletCache> addHdWalletCache(HdWalletCache item);

        Flowable<List<HdWalletCache>> getAllHdWalletCaches(String coinType);


        Flowable<String> getSingleEthBalance(String addr);

    }
}
